#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    button=new QPushButton(this);
    button->setText("播放");
    button->setGeometry(200,200,200,100);
    connect(button,&QPushButton::clicked,this,&Widget::handler);
    //创建播放音频的类
    sound=new QSound(":/music.wav",this);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::handler()
{
    //播放音频
    sound->play();
}

